Skip to content

fix: use correct supabase auth in stripe-setup edge-function#385

Merged
Yostra merged 3 commits into
stripe:supabasefrom
imor:rs/fix-broken-auth
Jun 15, 2026
Merged

fix: use correct supabase auth in stripe-setup edge-function#385
Yostra merged 3 commits into
stripe:supabasefrom
imor:rs/fix-broken-auth

Conversation

@imor

@imor imor commented May 25, 2026

Copy link
Copy Markdown

Fixes broken access control in the stripe-setup edge function. Since it's deployed with verify_jwt: false and only checked for a Bearer prefix, anyone knowing the project ref could trigger a destructive uninstall (drop schema, delete webhooks, cron jobs, Vault secrets).

Now the caller's token is validated against a per-install Vault secret (like stripe-worker) before any handler runs, forged tokens get 403. The Management token stripe-setup needs for its own API calls is passed separately via x-management-api-token.

@Yostra Yostra marked this pull request as ready for review June 9, 2026 00:37
@imor imor force-pushed the rs/fix-broken-auth branch from dca10d3 to 58b4848 Compare June 10, 2026 12:39

@matlin matlin left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good approach to ensure requests to the setup are being initiated from a privileged system. Requested some changes to make things more clear.

One question is whether the worker secret and setup secret could be shared?

Comment thread packages/sync-engine/src/supabase/edge-functions/stripe-setup.ts Outdated
@Yostra Yostra force-pushed the rs/fix-broken-auth branch from 038d1dd to c8cb7da Compare June 12, 2026 23:25
@imor

imor commented Jun 15, 2026

Copy link
Copy Markdown
Author

One question is whether the worker secret and setup secret could be shared?

In theory yes, but will be confusing to use a key named stripe_sync_worker_secret to use to authenticate to the stripe-setup function. Any specific reason for looking to share them?

@Yostra Yostra merged commit c6708ac into stripe:supabase Jun 15, 2026
2 of 3 checks passed
@imor imor deleted the rs/fix-broken-auth branch June 16, 2026 05:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants